﻿@page "/forminstances"
@attribute [Authorize(ABPLHQCSPermissions.FormInstances.Default)]
@using ABPLHQCS.Permissions
@using Microsoft.AspNetCore.Antiforgery
@using Volo.Abp.Application.Dtos
@using ABPLHQCS.Application
@using ABPLHQCS.Localization
@using Microsoft.Extensions.Localization
@using Volo.Abp.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Web
@using ABPLHQCS.FormInstances
@inject NavigationManager NavigationManager
@inject IStringLocalizer<ABPLHQCSResource> L
@inject AbpBlazorMessageLocalizerHelper<ABPLHQCSResource> LH
@inherits AbpCrudPageBase<IFormInstanceAppService, FormInstanceDto, Guid, PagedAndSortedResultRequestDto, FormInstanceCreateAndUpdateDto>
@inject ABPLHQCS.Categories.FormCategoryAppService categoryAppService
@inject IAntiforgery antiforgery


<Card>
    <CardHeader>
        <Row Class="justify-content-between">
            <Column ColumnSize="ColumnSize.IsAuto">
                <h2>@L["FormInstance"]</h2>
            </Column>
        </Row>
    </CardHeader>
    <CardBody>
        <DataGrid TItem="FormInstanceDto" Data="Entities" ReadData="OnDataGridReadAsync" CurrentPage="CurrentPage" TotalItems="TotalCount"
                  ShowPager="true" PageSize="PageSize">
            <DataGridColumns>
                <DataGridEntityActionsColumn TItem="FormInstanceDto" @ref="@EntityActionsColumn">
                    <DisplayTemplate>
                        <EntityActions TItem="FormInstanceDto" EntityActionsColumn="@EntityActionsColumn">
                         @*    <EntityAction TItem="FormInstanceDto" Text="@L["Edit"]" Visible=HasUpdatePermission
                                          Clicked="()=>OpenEditModalAsync(context)" /> *@
                            <EntityAction TItem="FormInstanceDto" Text="@L["Delete"]" Visible=HasDeletePermission
                                          Clicked="()=>DeleteEntityAsync(context)"
                                          ConfirmationMessage="()=>GetDeleteConfirmationMessage(context)" />
                        </EntityActions>
                    </DisplayTemplate>
                </DataGridEntityActionsColumn>
                <DataGridColumn TItem="FormInstanceDto"
                                Field="@nameof(FormInstanceDto.CreationTime)"
                                Caption="表单名称">

                </DataGridColumn>

                <DataGridColumn TItem="FormInstanceDto"
                                Caption="详情">
                    <DisplayTemplate>
                        <a target="_blank" href="@($"fdesign/fbpreview.html?recordId={ (context as FormInstanceDto).Id }")">表单详情</a>
                    </DisplayTemplate>
                
                </DataGridColumn>
            </DataGridColumns>
        </DataGrid>
    </CardBody>
</Card>


@code {
    public FormInstance()
    {
        CreatePolicyName = ABPLHQCSPermissions.FormInstances.Create;
        UpdatePolicyName = ABPLHQCSPermissions.FormInstances.Edit;
        DeletePolicyName = ABPLHQCSPermissions.FormInstances.Delete;
        LocalizationResource = typeof(ABPLHQCSResource);
       


    }
}